//
//  HeadCell.m
//  掌厨
//
//  Created by aoyolo on 15/10/22.
//  Copyright (c) 2015年 李祖铜. All rights reserved.
//

#import "HeadCell.h"
#import "DJPageView.h"
#import "Headmodel.h"

#import "HeadImgController.h"
#import "RecipeViewController.h"

@implementation HeadCell

- (void)setImg:(NSArray *)ImgArray
{
    NSMutableArray *arr = [NSMutableArray array];
    for (Headmodel *model in ImgArray)
    {
        [arr addObject:model.image];
    }
    
    //无限广告滚动数据实现
    DJPageView *pageView = [[DJPageView alloc] initPageViewFrame:CGRectMake(0, 0, ScreenWidth, 150) webImageStr:arr didSelectPageViewAction:^(NSInteger index) {
        
        Headmodel *model = ImgArray[index];
        HeadImgController *headImg = [[HeadImgController alloc]init];
        headImg.model = model;
        
        //push正向传值
        RecipeViewController *viewCtl = (RecipeViewController *)[self.superview.superview.superview nextResponder];
        headImg.hidesBottomBarWhenPushed = YES;//隐藏tarB
        [viewCtl.navigationController pushViewController:headImg animated:YES];
        
    }];
    //停留时间
    pageView.duration = 3;
    pageView.pageBackgroundColor = [UIColor clearColor];
    pageView.pageIndicatorTintColor = [UIColor whiteColor];
    pageView.currentPageColor = [UIColor orangeColor];
    [self addSubview:pageView];
}
@end
